package Test.Exam;

import java.util.Scanner;

/**
 * @ClassName problem_1
 * @since: 2024/3/9 09:44
 * @auth: kirito
 * @description:
 **/
public class problem_3 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        int n = in.nextInt();
        int[][] matrix = new int[n][n];
        for (int i = 0; i < n; i++) {
            String next = in.next();
            for (int j = 0; j < n; j++) {
                matrix[i][j] = next.charAt(j) - '0';
            }
        }

        for (int i = 1; i <= n; i++) {
            if (i == 1) {
                System.out.println(0);
            }else{
                System.out.println(count(matrix, i));
            }
        }

    }

    private static int count(int[][] matrix, int size) {
        int count = 0;
        int rows = matrix.length;
        int cols = matrix[0].length;
        for (int row = 0; row < rows - size + 1; row++) {
            for (int col = 0; col < cols - size+1; col++) {
                if (isPerfectSquare(matrix,row,col,size)) {
                    count++;
                }

            }
        }
        return count;
    }

    private static boolean isPerfectSquare(int[][] matrix, int row, int col, int size) {
        int count_0 = 0;
        int count_1 = 0;
        for (int i = row; i <row + size; i++) {
            for (int j = col; j <col+ size; j++) {
                if (matrix[i][j] == 0) {
                    count_0++;
                } else {
                    count_1++;
                }

            }
        }
        return count_0 == count_1;
    }


}
